package com.example.portraitorlandscapet;

import androidx.appcompat.app.AppCompatActivity;

import android.content.res.Configuration;
import android.os.Bundle;

public class Landscapet extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (this.getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_PORTRAIT){
            //竖屏
            setContentView(R.layout.activity_main);
        }else {
            //横屏
            setContentView(R.layout.activity_landscapet);
        }

    }
}